from random import random
import random


class Card():
    def __init__(self, suite, face):
        self._suite = suite
        self._face = face
    
    @property
    def suite(self):
        return self._suite
    
    @property
    def face(self):
        return self._face

    def __str__(self):
        if self._face == 1:
            face_str = 'A'
        elif self._face == 11:
            face_str = 'J'
        elif self._face == 12:
            face_str = 'Q'
        elif self._face == 13:
            face_str = 'K'
        else:
            face_str = str(self._face)
        
        return '%s%s' % (self.suite, face_str)
    
    def __repr__(self):
        return self.__str__()

class Poker():
    def __init__(self) -> None:
        self._current = 0
        self._cards = [Card(suite, face) for suite in '♠♥♣♦' for face in range(1,14)]
        self.shuffle()
    
    @property
    def next(self):
        cards = self._cards[self._current]
        self._current += 1
        if self.hasNext():
            return cards
        else:
            raise Exception('没有牌了')

    def shuffle(self):
        random.shuffle(self._cards)

    def hasNext(self):
        return self._current <= len(self._cards)
    
class Player():
    def __init__(self, name, ) -> None:
        self._name = name
        self._cards_on_hand = []

    @property
    def name(self):
        return self._name

    @property
    def cards_on_hand(self):
        return self._cards_on_hand

    def get_a_card(self, card):
        self._cards_on_hand.append(card)

    def sort_cards(self):
        self._cards_on_hand.sort(key=self.__class__.cards_key)

    @staticmethod
    def cards_key(card):
        return (card.suite, card.face)

class Game():
    def __init__(self) -> None:
        self._playsers = [Player(name) for name in ['一','二','三','四'] ]
        self._poker = Poker()

        self.main()

    def main(self):
        for _ in range(1,14):
            print(_)
            for player in self._playsers:
                print(player)
                player.get_a_card(self._poker.next)
        
    def __str__(self):
        str1 = ''
        for player in self._playsers:
            str1 += '%s: %s' % (player.name, player.cards_on_hand)

        return str1

    def __repr__(self):
        return self.__str__()

print(
    Game()
)
